package com.edgegateway.system.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.edgegateway.system.mapper.IotRuleFlowMapper;
import com.edgegateway.system.domain.IotRuleFlow;
import com.edgegateway.system.service.IIotRuleFlowService;
import com.edgegateway.common.core.text.Convert;

/**
 * 规则编排Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-01-03
 */
@Service
public class IotRuleFlowServiceImpl implements IIotRuleFlowService 
{
    @Autowired
    private IotRuleFlowMapper iotRuleFlowMapper;

    /**
     * 查询规则编排
     * 
     * @param id 规则编排主键
     * @return 规则编排
     */
    @Override
    public IotRuleFlow selectIotRuleFlowById(String id)
    {
        return iotRuleFlowMapper.selectIotRuleFlowById(id);
    }

    /**
     * 查询规则编排列表
     * 
     * @param iotRuleFlow 规则编排
     * @return 规则编排
     */
    @Override
    public List<IotRuleFlow> selectIotRuleFlowList(IotRuleFlow iotRuleFlow)
    {
        return iotRuleFlowMapper.selectIotRuleFlowList(iotRuleFlow);
    }

    /**
     * 新增规则编排
     * 
     * @param iotRuleFlow 规则编排
     * @return 结果
     */
    @Override
    public int insertIotRuleFlow(IotRuleFlow iotRuleFlow)
    {
        iotRuleFlow.setCreatedTime(new Date());
        return iotRuleFlowMapper.insertIotRuleFlow(iotRuleFlow);
    }

    /**
     * 修改规则编排
     * 
     * @param iotRuleFlow 规则编排
     * @return 结果
     */
    @Override
    public int updateIotRuleFlow(IotRuleFlow iotRuleFlow)
    {
        iotRuleFlow.setUpdatedTime(new Date());
        return iotRuleFlowMapper.updateIotRuleFlow(iotRuleFlow);
    }

    /**
     * 批量删除规则编排
     * 
     * @param ids 需要删除的规则编排主键
     * @return 结果
     */
    @Override
    public int deleteIotRuleFlowByIds(String ids)
    {
        return iotRuleFlowMapper.deleteIotRuleFlowByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除规则编排信息
     * 
     * @param id 规则编排主键
     * @return 结果
     */
    @Override
    public int deleteIotRuleFlowById(String id)
    {
        return iotRuleFlowMapper.deleteIotRuleFlowById(id);
    }

    @Override
    public List<IotRuleFlow> getAll() {
        return iotRuleFlowMapper.getAll();
    }

    @Override
    public IotRuleFlow getIotRuleFlowByFlowId(String flowId) {
        return iotRuleFlowMapper.getIotRuleFlowByFlowId(flowId);
    }
}
